#!/bin/bash -f

rm output.m

VAR=1

cp mandelbrot_orig.c mandelbrot.c

if [ "$1" = 1 ]; then
    cp mandelbrot_balanced.c mandelbrot.c
fi


echo "time_data = [ " > output.m


for i in {0..8}
do

    make clean
    make NB_THREADS=$i
for try in {1..20}
do
    ./mandelbrot $try >> output.m
done
done

echo "];" >> output.m

eog mandelbrot.ppm &